<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS代码设置节点属性</title>
</head>
<body>
    <script type="text/javascript">
        window.onload = function () {
            document.getElementById("but").onclick = function () {
                document.getElementById("myText").type = "checkbox";
            }
        }
    </script>
    <input type="text" id="myText"/>
<!--    点击这个按钮, 将文本框改成复选框-->
    <input type="button" value="将文本框修改为复选框" id="but"/>

</body>
</html>